/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.dusin.weijiwufang.bo;

import java.sql.Timestamp;

/**
 *
 * @author Admin
 */
public class VisitorBean {
    public final static byte COMMONUSER = (byte)1; //普通用户
    public final static byte ADVANCEDUSER =  (byte)4; //高级用户
    public final static byte SUPPERUSER = (byte)8;    //超级用户
    
    public final static String COMMNUSERNAME = "普通用户";
    public final static String ADVANCEDUSERNAME="高级用户";
    public final static String SUPPERUSERNAME="超级用户";
    
    private long id;
    private String loginName;
    private String password;
    private String employeeNo;
    private String realName;    
    private byte level;
    private String contact;
    private String note;
    private Timestamp createTime;

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getLoginName() {
        return loginName;
    }

    public void setLoginName(String loginName) {
        this.loginName = loginName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getEmployeeNo() {
        return employeeNo;
    }

    public void setEmployeeNo(String employeeNo) {
        this.employeeNo = employeeNo;
    }

    public String getRealName() {
        return realName;
    }

    public void setRealName(String realName) {
        this.realName = realName;
    }

    public byte getLevel() {
        return level;
    }

    public void setLevel(byte level) {
        this.level = level;
    }

    public String getContact() {
        return contact;
    }

    public void setContact(String contact) {
        this.contact = contact;
    }

    public String getNote() {
        return note;
    }

    public void setNote(String note) {
        this.note = note;
    }

    public Timestamp getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Timestamp createTime) {
        this.createTime = createTime;
    }
    
    public String getLevelName(){
        return getLevelName(level);
    }
    
    public int getIndex(){
        return getIndex(level);
    }
    public void setLevelIndex(int index){
        switch(index){
            case 0:
                level = VisitorBean.COMMONUSER;
                break;
            case 1:
                level = VisitorBean.ADVANCEDUSER;
                break;
            case 2:
                level = VisitorBean.SUPPERUSER;
                break;
            default:
                level = -1;
        }
    }
    
    public static int getIndex(byte level){
        switch(level){
            case VisitorBean.COMMONUSER:
                return 0;
            case VisitorBean.ADVANCEDUSER:
                return 1;
            case VisitorBean.SUPPERUSER:
                return 2;
            default:return -1;
        }
    }
    public static byte getLevelCode(String levelName){
        if(VisitorBean.COMMNUSERNAME.equals(levelName)){
            return VisitorBean.COMMONUSER;
        }else if(VisitorBean.ADVANCEDUSERNAME.equals(levelName)){
            return VisitorBean.ADVANCEDUSER;        
        }else if(VisitorBean.SUPPERUSERNAME.equals(levelName)){
            return VisitorBean.SUPPERUSER;
        }else{
            return 0;
        }
    }
    
    public static String getLevelName(byte levelCode){
        switch(levelCode){
            case VisitorBean.COMMONUSER:
                return VisitorBean.COMMNUSERNAME;
            case VisitorBean.ADVANCEDUSER:
                return VisitorBean.ADVANCEDUSERNAME;
            case VisitorBean.SUPPERUSER:
                return VisitorBean.SUPPERUSERNAME;
            default:
                return null;
        }
    }
}
